﻿$(function () {
    var url = new Url();
    var $Id = url.GetQueryString("id");
    var fuser = new FinancialUser();
    fuser.BindDetail($Id);//绑定


    $(".btnReturn").bind('click', function () {
        history.go(-1);
        return false;
    })
})
//绑定
var FinancialUser = function () { };

FinancialUser.prototype = {
    BindDetail: function ($Id) {
        $.ajax({
            type: "get",
            url: "../Handler/FinancialUser.ashx",
            dataType: "json",
            data: { Id: $Id, type: 4 },
            complete: function () {
            },
            success: function (result) {
                if (result.Status) {
                    $(".divName").text(result.Data.Name);
                    $(".divIDCard").text(result.Data.IDCard);
                    $(".divPhone").text(result.Data.Phone);
                    $(".divAddress").text(result.Data.Address);
                    if (result.Data.AddressZipCode) {
                        $(".divAddressZipCode").text(result.Data.AddressZipCode);
                    }
                    if (result.Data.VistRecord && result.Data.VistRecord.length > 0) {
                        $("#visitInfo").text(result.Data.VistRecord[0].VisitMemo);
                    }
                    if (result.Data.IsGetUserEmgy) {
                        $.getJSON("../Handler/FinaUserEmgyHandler.ashx",
                                  { type: 0, UserId: $Id, _: Math.random() },
                                   function (result) {
                                       if (result.Status) {
                                           $(".divUserEmgyName").text(result.Data.Name);
                                           $(".divUserEmgyCertificateTypeName").text(result.Data.CertificateTypeName);
                                           $(".divUserEmgyIDCard").text(result.Data.CertificateNo);
                                           $(".divUserEmgyPhone").text(result.Data.Phone);
                                           $(".divUserEmgyAddress").text(result.Data.Address);
                                           $(".divUserEmgyEmail").text(result.Data.Email);
                                       }
                                   });
                    }
                    else {
                        $(".ul1 li:eq(1)").hide();
                        $("#li_finauserEmgy").hide();
                    }

                }
            }
        });


    }
}